package com.zezer.site.servlet;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zezer.site.dao.ContactDao;

public class ContactUsServlet extends BaseServlet {

    private static final String DEST = "./contact.html";

    @Override
    protected void process(HttpServletRequest req, HttpServletResponse resp) {
        try {
            String action = getStringParameter(req, PARAMETER.ACTION);

            if (PARAMETER.NEW.equalsIgnoreCase(action)) {
                String msg = getStringParameter(req, PARAMETER.MSG);
                String title = getStringParameter(req, PARAMETER.REPLY);

                new ContactDao().addMessage(msg, title);
            }

            writeResult(resp, "success");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
